<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ajax-get请求方法</title>
    <script src="jquery.js"></script>
</head>
<body>
     <form action="index.html" method="get" enctype="multipart/form-data">
        <input type="text" name="uname" placeholder="请输入用户名"><br><br>
        <input type="password" name="password" placeholder="请输入密码"><br><br>
        <input type="file" name="photo"><br>
        <button type="submit">登录</button>
    </form>
</body>
<script>
   $('form').submit(function(ev){
       ev.preventDefault();
       var data = new FormData(this);
    //    添加formdata对象的数据
       data.append('time',new Date());
       console.log(data);
       $.post({
           url:'index.html',
           data:Data,
        //    阻止默认的数据内容被转换成字符串，设置的类型等于提交的类型
           processData:false,
         //默认内容类型是urlencoded  阻止默认的内容类型 设置类型等于提交类型 
           contentType:false,
           success:function(resData){

           }
        })

   })
</script>
</html>